{extend name="public/base"/}
{block name="style"}
<link href="__PUBLIC__/ieasy/css/classify.css?v=2.1.49" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__PUBLIC__/ieasy/css/vendor.css" />
<link href="__PUBLIC__/ieasy/css/font_apds0v8n2bhp8pvi.css" rel="stylesheet">
<link href="__PUBLIC__/ieasy/css/front.css" rel="stylesheet">
 <style>
            .weui_article {
        margin-bottom: 30px;
        font-size: 18px;
        font-weight: normal;
        line-height: 170%;
    }

    .weui_article p {
        margin: .7em 0;
        text-indent: 2em;
    }
    .other_login{overflow: auto;text-align: center}
.other_login a.reg_link{color:#2897ed}
.other_login ul{ margin: 0 auto; overflow: auto; display: flex;}
.other_login ul li{
    padding: 3px 8px;
    border: 0 none;
        width:100%;
}
.other_login ul li a{color: #9e9fa4}
.other_login ul li a.btn_login{
    display: block;
    background: #f9f6e5;
    color: #555;
    width: 100%;
    margin:8px auto;
    border: 1px solid #ddd0a6;
    border-radius: 6px;}
.dsflogin{
    text-align: center;
    border-bottom: 1px solid #ddd;
    position: relative;
    margin: 16px 5px;
}
.dsflogin span{
    padding: 0 5px;
    color: #666;
    background-color: #f9f8f8;
    height: 36px;
    line-height: 36px;
    font-size: 14px;
    position: absolute;
    left: 50%;
    margin-left: -75px;
    z-index: 9;
    top: -20px;
    width: 150px;
}
.bgs.login_wxpng{
        background: url(../../../images/weixin.png) transparent no-repeat;
    background-size: 30px auto;
    display: inline-block;
    width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 5px
}
.bgs.login_phone{
        background: url(/public/ieasy/images/phone.png) transparent no-repeat;
    background-size: 18px auto;
    display: inline-block;
    width: 20px;
    height: 30px;
    vertical-align: middle;
    margin-right: 5px
}
.btn {
    border: 1px solid #df62e4;
    background: #df62e4;
    text-align: center;
    color: #fff;
    height: 40px;
    line-height: 39px;
    padding: 0 8px;
    margin: 12px auto;
    display: inline-block;
    border-radius: 6px;
}
.btn {
    border: 1px solid #df62e4;
    background: #df62e4;
    text-align: center;
    color: #fff;
	width:120px;
    height: 40px;
    line-height: 39px;
    padding: 0 8px;
    margin: 12px auto;
    display: inline-block;
    border-radius: 6px;
}
    .input_box{border: 1px #cdcdcd solid;border-bottom: 0 none;background: #fff; position: relative;}
.input_box.short{width: 50%}
.input_box.last{border-bottom: 1px #cdcdcd solid;}
.input_box input{border: 0 none; background: #fff; height: 42px; line-height: 42px;text-indent: 6px; width: 100%}
.input_box textarea{border: 0 none; background: #fff; height: 120px; line-height: 42px;text-indent: 6px; width: 100%}
.input_box label{position: absolute; left: 6px; top:10px; color:#bfbfbf}
.input_box.error label{color:#ff1e1e}
.btn{border:1px solid #7ccae1;background: #10AEFF; text-align: center; color: #fff; height: 40px; line-height: 39px; padding: 0 8px; margin:12px auto; display: inline-block;border-radius: 6px;}
a.btn{color: #fff;}
.btn.block{display: block;padding: 0;}
button.btn.block{width: 100%}
.btn.red{border-color: #c7ce19; background: #c7ce19; color: #fff}
a.btn.red{color: #fff}
.btn.white{border-color: #d4d4d4; background: #fff; color: #313030}
a.btn.white{color: #313030}
.btn.light-blue{border-color: #52b7ed; background: #52b7ed; color: #fff}
a.btn.light-blue{color: #fff}
.btn.liner{
    background:linear-gradient(#FFF,#e5e5e5) repeat scroll 0 0 transparent;
    background:-moz-linear-gradient(#fff,#e5e5e5);
    background:-webkit-gradient(linear,center top,center bottom,from(#fff),to(#e5e5e5));
    background:-webkit-linear-gradient(#fff,#e5e5e5);
    border-color: #d4d4d4;
    color:#333
}
.btn.disabled{color:#7d7d87;background: #efefef}
.no-margin{margin: 0}
.no-margin-bottom{margin-bottom: 0}
.no-margin-top{margin-top: 0}
img.captcha {
    border: 1px solid #CDCDCD;
}
.mgt12 {
    margin-top: 12px;
}
.fn-right {
    float: right;
}

.fn-left, .fn-right {
    display: inline;
}
.input_box.last {
    border-bottom: 1px #cdcdcd solid;
}
.input_box.short {
    width: 50%;
}
.mgt12 {
    margin-top: 12px;
}
.input_box {
    border: 1px #cdcdcd solid;
    border-bottom: 0 none;
    background: #fff;
    position: relative;
}
.fn-left {
    float: left;
}
.fn-left, .fn-right {
    display: inline;
}
.panel {
    padding: 16px 12px;
}
.other_login {
    overflow: auto;
    text-align: center;
}
.other_login a.reg_link {
    color: #2897ed;
}
a:visited {
    color: #313030;
}
a:link {
    color: #313030;
}
.fn-right {
    float: right;
}
.fn-left, .fn-right {
    display: inline;
}
ins, a {
    text-decoration: none;
}
.mod_content {
    padding: 3px 12px;
    background-color: #fff;
    overflow: auto;
    line-height: 40px;
    font-size: 16px;
}
.mod_content.c1{
    background-color: #fff;
    line-height: 1.8em;
}
.mod_content.c1 ul>li{
    padding: 5px 0
}
.mod_content.c1 ul>li a{
    display: inline-block;
    color:#2897ed
}
        </style>
{/block}
{block name="body"}
        <div id="console_main"></div>
<div class="head_tit_box">
    <a href="javascript:;" class="head_return_page_but"></a>
        <div class="head_menu_but_box">
        <a href="javascript:;" class="head_menu_but"></a>
    </div>
        <h1>注册</h1>
</div>
<!--导航-->
{block name="include"}{include file="public:dropnav" /}{/block}
    <div style="padding-bottom:45px">
            <div style="padding-top: 25px;"></div>
            <div class="panel signup-card1">
                <div class="err_msg fn-hide">
                </div>
                <form class="vail" id="signup">
                    <div class="input_box">
                        <input class="required"   id="mobile" name="mobile" type="text" value="" placeholder="手机号">
                        </input>
                    </div>
                    <div class="input_box">
                        <input class="required" id="password" name="password" type="password" placeholder="密码" value="">
                        </input>
                    </div>
                    <div class="input_box last">
                        <input class="required" id="repassword" name="repassword" type="password" placeholder="确认密码" value="">
                        </input>
                    </div>
                    <div class="fn-clear">
                        <div class="input_box short last mgt12 fn-left">
                            <input class="required" name="code" id="code" type="text" placeholder="验证码" value="">
                            </input>
                        </div>
                        <button type="button" id="code_phone" class="btn fn-right" onclick="sendMessage()"> 获取验证码</button>
                    </div>
                    <div style="clear:both;"></div>
                     <button class="btn block submit" type="submit">
                        提交
                     </button>
                </form>
                <div class="other_login">
                    <div class="dsflogin">
                        <span>
                            已有帐号？立即登录»
                        </span>
                    </div>
                    <ul>
                        <li>
                            <a class="btn block btn_login" href="/login/phone.html?jumpurl={$backurl|urlencode}">
                                <span class="bgs login_phone">
                                </span>
                                手机注册登录
                            </a>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <a class="btn block btn_login" href="/login/login.html?type=qq&jumpurl={$backurl|urlencode}">
                                <span class="iconfont icon-qq" style="font-size:25px;color:#FE9770;margin-right: 5px"></span>QQ登录</a>
                        </li>
                    </ul>
                    
                </div>
            </div>
            <div class="mod_content c1 signup-card1">
                <ul>
                    <li class="orange">
                        <a href="/login/forget?backurl={$backurl|urlencode}" class="fn-left reg_link">忘记密码？</a>
                    </li>
                    <li><br/>
                    </li>
                </ul>
            </div>
        </div>
		 {block name="include"}{include file="public:tabbar" /}{/block}
{/block}
{block name="script"}
	<script type="text/javascript" src="__PUBLIC__/ieasy/js/zepto.min.js?v=2.1.49"></script>
	<script type="text/javascript" src="__PUBLIC__/ieasy/js/zepto.cookie.min.js?v=2.1.49"></script>
	<script type="text/javascript">
		$(function () {
		//返回
		$('.head_return_page_but').click(function () {
			window.history.go(-1);
		});

		//菜单//{{{md5code}}}
		$('.pop_up_menu_box > i, .head_menu_but').click(function () {
			$('.head_menu_but').toggleClass('head_menu_but_open');
			$('.pop_up_menu_box').toggleClass('pop_up_menu_show');
		});
		
		//关闭弹框
		$('.christmas_close_2,.christmas_main_but').click(function(){
			ac_val += 1;
			$('.christmas_popup_box').remove();
			$.fn.cookie('ac_val',ac_val,{expires: 0.33, path: '/'});
		});
		
		
	});
	</script>
    <script type="text/javascript">
			$("body").on("click", ".submit", function() {
				
				if ($('#mobile').val() == '') {
					$("div.err_msg").html('手机号码不能为空').show();
					return false;
				}
				if ($('#password').val() == '') {
					$("div.err_msg").html('密码不能为空').show();
				  
					return false;
				}

				if ($('#repassword').val() == '') {
					$("div.err_msg").html('确认密码不能为空').show();
					return false;
				}

				if ($('#password').val() !=$('#repassword').val())
				{
					$("div.err_msg").html('密码不一致').show();
					return false;
				}
				if ($('#code').val() == '') {
					$("div.err_msg").html('验证码不能为空').show();
					return false;
				}
				
				$.ajax({
					type: 'POST',
					url: '/register',
					data: $("form").serialize(),
					success: function (json) {
						if (json.code == 1) {
							location.href = '/personal/info';
						} else {
							$("div.err_msg").html(json.msg).show();
						}
					},
				});
				return false;
			});
        
		function validateMobile() {
		var mobile = document.getElementById('mobile').value;		
		if (mobile.length == 0) {
			$("div.err_msg").html('手机号不能为空').show();
			document.getElementById('mobile').focus();
			return false;
		}
		var phoneReg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
		if (!phoneReg.test(mobile)) {
			$("div.err_msg").html('请输入有效的手机号码').show();
			document.getElementById('mobile').focus();
			return false;
		}
		if(mobile.length != 11){
			$("div.err_msg").html('请输入有效的手机号码').show();
			document.getElementById('mobile').focus();
			return false;
		}
		return true;
	}

	function sendMessage() {
		if (validateMobile()) {
			var form = $("form");
			$.ajax({
				type: 'POST',
				url: '/login/getcode',
				data: form.serialize(),
				success: function(json){
					if(json.code == 1) {
						$("div.err_msg").html("验证码发送成功").show();
						$('#code_phone').attr("disabled", "disabled");
						var i = 61;
						timer();
						function timer() {
							i--;
							$('#code_phone').text(i + '秒后重发');
							if (i == 0) {
								clearTimeout(timer);
								$('#code_phone').removeAttr("disabled");
								$('#code_phone').text('重新发送');
							} else {
								setTimeout(timer, 1000);
							}
						}

					}
				},
			});
		}
	}

    </script>
{/block}